home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: Shear 2.12, IE Arexx script ** Image Engineer Macro script ** Copyright © by Patrik M Nydensten ** 14/1 1997 Stockholm/Sweden ** ** Shear PRIMARY image at X or/and Y-axis. ** ** MS: Alpha now uses zoomlevel of original image ** MS: Support for saving last used results added */ Options Results Signal on error if arg()==0 then exit pic=arg(1) PROJECT_INFO pic WIDTH IW=result PROJECT_INFO pic HEIGHT IH=result PROJECT_INFO pic ZOOM origzoomval=result if exists("ie:prefs/veshear.cfg") == "1" then do call open("temp","ie:prefs/veshear.cfg","R") values=readln("temp") parse var values ok Xoff Yoff ResizeQ . call close("temp") end else do Xoff=100 Yoff=0 ResizeQ=0 end 'FORM "Share" "Use|Cancel"', 'INTEGER,"X Amount",'||((-3)*IW)|| ',' ||(IW*3)|| ','Xoff',SLIDER', 'INTEGER,"Y Amount",'||((-3)*IH)|| ',' ||(IH*3)|| ','Yoff',SLIDER', 'CHECKBOX,"Use original image size",'ResizeQ'' values=result parse var result ok Xoff Yoff ResizeQ . if ok = 0 then exit call open("temp","ie:prefs/veshear.cfg","W") res=writeln("temp",values) call close("temp") 'RESIZE' pic IW IH LoadImage = Result /* X shearing ------------------------------ */ 'PROJECT_INFO' LoadImage 'WIDTH' /* Get width of image */ IW = RESULT 'PROJECT_INFO' LoadImage 'HEIGHT' /* Get height of image */ IH = RESULT if ResizeQ = 0 then do 'RESIZE' LoadImage (IW+abs(Xoff)*2) IH 'CENTER' NewImage = Result 'CLOSE' LoadImage LoadImage = NewImage end if Xoff ~= 0 then do 'OPEN' '"IE:Alpha/Gradient.alpha"' '8BIT' GradientImage = Result PROJECT_SET gradientimage ZOOM origzoomval 'ROTATE' GradientImage 90 'FAST' RotatedImage = Result 'CLOSE' GradientImage 'SCALE' RotatedImage (IW+abs(Xoff)*2) IH 'BEST' XAlphaImage = Result 'CLOSE' RotatedImage end do while (Xoff ~= 0) if Xoff > 0 then do if Xoff > 127 then do XD = 127 ; Xoff = Xoff - XD end else do XD = Xoff ; Xoff = Xoff - XD end end else do if Xoff < -127 then do XD = -127 ; Xoff = Xoff - XD end else do XD = Xoff ; Xoff = Xoff - XD end end 'MARK' XAlphaImage 'ALPHA' 'MARK' LoadImage 'PRIMARY' 'DISPLACE' XD 0 CalcType NewImage = result 'CLOSE' LoadImage LoadImage = NewImage end if XAlphaImage ~= 'XALPHAIMAGE' then 'CLOSE' XAlphaImage /* Y shearing ------------------------------ */ 'PROJECT_INFO' LoadImage 'WIDTH' /* Get width of image */ IW = RESULT 'PROJECT_INFO' LoadImage 'HEIGHT' /* Get height of image */ IH = RESULT if ResizeQ = 0 then do 'RESIZE' LoadImage IW (IH+abs(Yoff)*2) 'CENTER' NewImage = Result 'CLOSE' LoadImage LoadImage = NewImage end if Yoff ~= 0 then do 'OPEN' '"IE:Alpha/Gradient.alpha"' '8BIT' GradientImage = Result 'SCALE' GradientImage IW (IH+abs(Yoff)*2) 'BEST' YAlphaImage = Result 'CLOSE' GradientImage end do while (Yoff ~= 0) if Yoff > 0 then do if Yoff > 127 then do YD = 127 ; Yoff = Yoff - YD end else do YD = Yoff ; Yoff = Yoff - YD end end else do if Yoff < -127 then do YD = -127 ; Yoff = Yoff - YD end else do YD = Yoff ; Yoff = Yoff - YD end end 'MARK' YAlphaImage 'ALPHA' 'MARK' LoadImage 'PRIMARY' 'DISPLACE' 0 YD CalcType NewImage = result 'CLOSE' LoadImage LoadImage = NewImage end if YAlphaImage ~= 'YALPHAIMAGE' then 'CLOSE' YAlphaImage exit /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do /* Did the user just cancel us? */ IE_TO_FRONT LAST_ERROR 'REQUEST "'||Result||'"' exit end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||Result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' exit end